<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>桃李科技-打卡</title>
    <link rel="stylesheet" href="__ADMIN__/weUI/css/weui.min.css" />
    <link rel="stylesheet" href="__ADMIN__/weUI/css/page.css" />
</head>

<body ontouchstart>
    <div class="weui-toptips weui-toptips_warn js_tooltips">错误提示</div>
    <div class="page">
        <div class="page__hd">
            <h1 class="page__title">桃李科技-打卡</h1>
            <p class="page__desc">最近打卡时间：<span id="spLast"><{$lastSignTime|date="Y-m-d H:i:s",###}></span></p>
        </div>
        <div class="weui-cells__title">最近6次打卡记录</div>
        <div class="weui-cells" style="min-height: 250px;" id="divList">
             <volist name="rows" id="v">
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <p><{$v['signintime']|date="Y-m-d",###}></p>
                    </div>
                    <div class="weui-cell__ft"><{$v['signintime']|date="H:i:s",###}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<{$v['signouttime']|date="H:i:s",###}></div>
                </div>
            </volist>
        </div>
        <div class="page__bd page__bd_spacing">
            <a href="javascript:;" id="btnSign" class="weui-btn weui-btn_primary" >
                打卡
            </a>
        </div>
        <input type="hidden" name="weixinid" value="<{$weixinid}>" id="txtWeixinId">
        <!-- <input type="hidden" name="weixinid" value="lub_weixin" id="txtWeixinId"> -->
    </div>
    <div style="height: 10px;"></div>
    <div class="weui-footer">
            <p class="weui-footer__links">
                <a href="javascript:void(0);" class="weui-footer__link">桃李科技</a>
            </p>
            <p class="weui-footer__text">Copyright &copy; 2015-2016 ittaoli.com</p>
        </div>
    <!-- <script src="__ADMIN__/weUI/js/zepto.min.js"></script> -->
    <script src="__ADMIN__/weUI/js/jquery-1.11.2.min.js"></script>
    <script src="__ADMIN__/weUI/js/lub_weUI.js"></script>
    <script src="__ADMIN__/weUI/js/lub_common.js"></script>
    <!-- <script src="__ADMIN__/weUI/js/touch.js"></script> -->
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script type="text/javascript">
        $('#btnSign').on('click',function(){
            lub.progress();
            var url='<{:U("sign")}>',
            $divList=$('#divList');
            $.post(url, { weixinid: $('#txtWeixinId').val() }, function(response){
                // alert(JSON.stringify(response));
                  if(response){
                      if(response.res>0){
                        var row=response.row;
                        $('#spLast').text(lubCommon.getTime(row.signouttime));
                        if(response.count>0){//已签到过，只改后面时间
                            $('#divList .weui-cell').first().find('.weui-cell__ft').html(lubCommon.getTime(row.signintime).substr(11,8)+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+lubCommon.getTime(row.signouttime).substr(11,8));
                        }else{
                            var html='<div class="weui-cell">';
                            html+='<div class="weui-cell__bd">';
                            html+='<p>'+lubCommon.getTime(row.signintime).substr(0,10)+'</p>';   
                            html+='</div>';
                            html+='<div class="weui-cell__ft">'+lubCommon.getTime(row.signintime).substr(11,8)+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+lubCommon.getTime(row.signouttime).substr(11,8)+'</div>';
                            html+='</div>';
                            $divList.prepend(html);
                        }
                        alert('打卡成功！');
                      }else{
                        alert('打卡失败！');
                      }
                  }else{
                    alert('打卡失败,请确认已连接桃李科技内部网络！');
                  }
                  lub.hideProgress();
            })
        });

        
    </script>
</body>

</html>
